public class Program {

	public static final int X = 7;
	public static final int Y = 7;
	public static final int[] WIND = { 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 1, 0 };
	public static final Coordinate START = new Coordinate(5, 0);
	public static final Coordinate GOAL = new Coordinate(1, 6);
	public static final float ALFA = 0.1f;
	public static final float GAMMA = 0.9f;
	private static final int nbOfEpisodes  = 5000;
	private static EpsilonPolicy policy;
	private static GridWorld world;
	

	public static void main(String[] args) {
		Policy policy = new EpsilonPolicy(0.2f);
		GridWorld world = new GridWorld(X, Y, WIND, START, GOAL, ALFA, GAMMA);

		for (int i = 0; i < nbOfEpisodes; i++) {
			while (!world.isInGoal()) 
				world.takeStep(policy);
			world.reset();
		}
		
//		question3();
		
//		world.writeDownInfo();
		
		System.out.println(world);
		System.out.println(world.bestDirections());
	}
	
	public static void question3( ){
		
		world.resetBuffers();
		
		policy.setNewEpsilonValue(0f);
		
		for (int i = 0; i < nbOfEpisodes; i++) {
			while (!world.isInGoal()) 
				world.takeStep(policy);
			world.reset();
		}
	}
}
